﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Globalization;
namespace Recherche_Concert
{
    public class Weather
    {
        #region Champs
        private string _dayOfWeek = "inconnu";

        public string DayOfWeek
        {
            get { return _dayOfWeek; }
            set { _dayOfWeek = value; }
        }
        private string _low = "inconnu";

        public string Low
        {
            get { return _low; }
            set { _low = value; }
        }
        private string _high = "inconnu";

        public string High
        {
            get { return _high; }
            set { _high = value; }
        }

        private string _condition = "inconnu";

        public string Condition
        {
            get { return _condition; }
            set { _condition = value; }
        }

        #endregion

        #region Constructeur
        public Weather()
        {
        }
        public Weather(string DayOfWeek, string Low, string High,string Condition)
        {
            this.DayOfWeek = DayOfWeek;
            this.Low = Low;
            this.High = High;
            this.Condition = Condition;
        }
        #endregion

        #region Méthodes
        //4Jours
        public static string getDay(DateTime dateConcert)
        {
            string Day="inconnu";
            DateTime testDate = DateTime.Now.Date;
            TimeSpan ts = dateConcert - testDate;
            int differenceInDays = ts.Days;

                switch (differenceInDays)
                {
                    case 0:
                        Day = "Auj";
                        break;
                    case 1:
                        Day = dateConcert.ToString("ddd", new CultureInfo("fr-FR"));
                        break;
                    case 2:
                        Day = dateConcert.ToString("ddd", new CultureInfo("fr-FR"));
                        break;
                    case 3:
                        Day = dateConcert.ToString("ddd", new CultureInfo("fr-FR"));
                        break;
                    default:
                        Day="Météo non connue";
                        break;
                }
                string oldstring = Day;
                string newstring = oldstring[0].ToString().ToUpper() + oldstring.Substring(1).ToLower();


           //     newstring.Trim();
           //int test =newstring.Length - 1;
           //newstring.Replace(newstring, "caca");
            return newstring;
        }

        public String toStringWeather()
        {
            string unWeather = "Condition : "+this.Condition+" Temperature min : "+this.Low+" Temperature max : "+this.High;
            return unWeather;
        }
        #endregion
    }
}
